package com.itheima.server.impl;

import com.itheima.dao.BookDao;
import com.itheima.domain.Book;
import com.itheima.server.BookServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BookImpl implements BookServer {
    @Autowired
    private BookDao bookDao;

    @Override
    public List<Book> serchList() {
        return bookDao.findAll();
    }

    @Override
    public Book findById(Integer id) {
        return bookDao.findById(id);
    }

    @Override
    public int save(Book book) {
        return bookDao.insert(book);
    }

    @Override
    public int update(Book book) {
        return bookDao.update(book);
    }

    @Override
    public int delete(Integer id) {
        return bookDao.delete(id);
    }
}
